/**
 *
 * @author Axel Huizinga - axel@go2ghana.de
 * All rights reserved
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *   - Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *   - Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */

package;

import me.cunity.php.dom.DOMDocument;
import me.cunity.php.dom.DOMNodeList;
import me.cunity.site.Menu;
import me.cunity.site.SEO;
import php.Lib;

class Site 
{
	public static var configDir:String;
	public static var instance:Site;
	public static var siteMap:String;
	var menu:Menu;
	var seo:SEO;
	
	static function main() 
	{
		instance = new Site();
		trace('<pre style="position:absolute;height:100%;width:80%;overflow:auto;">');
	}
	
	function new() {}
	public function init(cDir:String = 'site/') {
		configDir = cDir;
		var xDoc:DOMDocument = new DOMDocument();
		xDoc.preserveWhiteSpace = false;
		xDoc.load(configDir + 'menu.xml');		
		menu = new Menu(xDoc.documentElement, null);
		seo = new SEO(menu.createLiveMenu());
		siteMap = seo.siteMap();
	}

}